<template>
  <transition name="move">
    <!-- 最大的背景灰色 点击消失 -->
    <div
      class="mark-wrap"
      v-show="modelValue"
      @click="$emit('update:modelValue', false)"
    >
      <div class="content-wrap" @click.stop>
        <h3>{{ title }}<span class="close" @click="$emit('update:modelValue', false)">×</span></h3>
        <div class="content">
          <slot></slot>
        </div>
        <!-- 底部 具名插槽 -->
      </div>
    </div>
  </transition>
</template>

<script>
export default {
  props: {
    modelValue: {},
    title: {
      type: String,
      default: "手机号登录",
    },
  },
};
</script>

<style lang="less" scoped>
* {
  margin: 0;
  padding: 0;
}
.mark-wrap {
  position: fixed;
  top: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.3);
  width: 100vw;
  height: 100vh;
}
.content-wrap {
  z-index: 9998;
  min-width: 530px;
  max-height: 500px;
  overflow: auto;
  background-color: white;
  border-radius: 10px;
  position: absolute;
  top: 200px;
  left: 50%;
  transform: translateX(-50%);
}
.close {
  position: absolute;
  top: 0px;
  right: 20px;
  font-size: 16px;
  cursor: pointer;
  color: #fff;
}
.content-wrap h3 {
  text-align: left;
  position: relative;
  z-index: 10;
  border-bottom: 1px solid #191919;
  border-radius: 4px 4px 0 0;
  background: #2d2d2d;
  color: #fff;
  font-weight: bold;
  height: 38px;
  line-height: 38px;
  padding-left: 18px;
  padding-right: 45px;
  font-size: 16px;
}
.content {
  padding: 10px;
}
</style>